<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Unit_organisasi extends Admin_Controller
{
	public function __construct()
	{
		parent::__construct();
		$this->load->model('penunjang/unit_organisasi_model');
	}

	public function index()
	{
		$data['module'] = "penunjang";
		$data['page'] = 'layout_unit_organisasi';
		$this->load->view($this->layout_content,$data);	
	}

	public function data()
	{
		$unor = $this->unit_organisasi_model->get_unor();
		$this->output->set_content_type('application/json')->set_output(json_encode($unor));	
	}

	public function edit()
	{
		if( $this->uri->segment(4) )
		{
			$id = $this->uri->segment(4);

			$data['unor'] = $this->unit_organisasi_model->get_unor_by_id( $id ) -> result();
			$data['module'] = "penunjang";
			$data['page'] = 'layout_edit_unit_organisasi';
			$this->load->view($this->layout_content,$data);
		}
		else
		{
			show_404();
		}
		
	}
}